# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>

_gemname=pathutil
pkgname=ruby-pathutil
pkgver=0.16.2
pkgrel=2
pkgdesc='Faster pure Ruby implementation of Pathname with extra bits'
url='https://github.com/envygeeks/pathutil'
arch=('any')
license=('MIT')
depends=('ruby' 'ruby-forwardable-extended')
makedepends=('ruby-rdoc')
options=('!emptydirs')
source=(https://github.com/envygeeks/pathutil/archive/v${pkgver}/${pkgname}-${pkgver}.tar.gz)
sha512sums=('d06daf365b94dacd33966f3928a53f0f00d2fca7b9f6348a7efd2b55ab5ba937459e5bd78fde241f30749a1ae55e4ae3ba1ed8945b5333464e7d3ce9666cd054')
b2sums=('5a9d1dac1f1171ee6bc447725c04883cb56a9071927f3e0fdbcb9754345ac77a6609533a1308a411cb22658caeb2a4bed49225923af109bca288cfb3aeb3d669')

prepare() {
  cd ${_gemname}-${pkgver}
  mv Gem.gemspec ${_gemname}.gemspec
  sed -r 's|~>|>=|g' -i ${_gemname}.gemspec
}

build() {
  cd ${_gemname}-${pkgver}
  gem build ${_gemname}.gemspec
}

package() {
  cd ${_gemname}-${pkgver}
  local _gemdir="$(gem env gemdir)"
  gem install --ignore-dependencies --no-user-install -i "${pkgdir}${_gemdir}" \
    -n "${pkgdir}/usr/bin" ${_gemname}-${pkgver}.gem -- --use-system-libraries
  install -Dm 644 README.md -t "${pkgdir}/usr/share/doc/${pkgname}"
  install -Dm 644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"

  cd "${pkgdir}/${_gemdir}"
  rm -rf cache gems/${_gemname}-${pkgver}/{ext,lib/*/*.so} \
    extensions/*/*/${_gemname}-${pkgver}/{mkmf.log,gem_make.out}
}

# vim: ts=2 sw=2 et:
